using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;

namespace Sedna.Core.Controller.Configurations
{
    public class Boolean2StringTranslator: IDataTranslator
    {
        public object Translate(Control control, object value)
        {
            return Translate(control, value, typeof(bool));
        }

        public object Translate(Control control, object value, Type targetType)
        {
            if (targetType == typeof(bool) && value != null)
            {
                return Boolean.Parse(value.ToString()) ? 'Y' : 'N';
            }
            return 'N';
        }
    }
}
